/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * FrmBaseEdicion.java
 *
 * Created on 03/06/2011, 21:00:39
 */

package logano;

import java.util.logging.Level;
import java.util.logging.Logger;
import loganosystem.contrato.Entidad;
import loganosystem.negocio.EntidadNegocio;

/**
 *
 * @author loreh
 */
public class FrmBaseEdicion extends javax.swing.JFrame {

    protected Entidad entidad;
    protected EntidadNegocio entidadNegocio;

    /** Creates new form FrmBaseEdicion */
    public FrmBaseEdicion() {
        initComponents();
    }

    protected void save()
    {
        try
        {
            this.getValues();
        }
        catch (Exception e)
        {

        }
        
        try
        {
            this.getNegocio().save(this.entidad);
            //TODO: Mostrar mensaje de informacion
        }
        catch (RuntimeException exception)
        {
            //TODO: Mostrar mensaje de error
        }
    }

    protected void initialize() throws Exception{
        this.setValues();
    }

    protected Entidad getValues() throws Exception
    { 
        return null;
    }

    protected void setValues() throws Exception
    {
    }

    protected EntidadNegocio getNegocio(){ return null; }    

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setName("Form"); // NOI18N
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowOpened(java.awt.event.WindowEvent evt) {
                formWindowOpened(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
        try {
            this.initialize();
        } catch (Exception ex) {
            Logger.getLogger(FrmBaseEdicion.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_formWindowOpened

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new FrmBaseEdicion().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables

}
